<template>
	<div>
		<div v-for="e in list">
			<h3>{{e.title}}</h3>
			<div class="title">
				<span>发布的时间是：{{e.add_time | forTime(' MMMM Do，YYYY')}}</span>
				<span>点击的次数是{{e.click}}</span>
			</div>
			<div v-html="e.content"></div>
		</div>
		<comment :id="data"></comment>
	</div>
</template>

<script>
import comment from './comment.vue'
	export default{
		data(){
			
			return {
				data:this.$route.params.id,
				list:[
					
				]
			}
		},
		created(){
			this.getData()
		},
		methods:{
			getData(){
				this.$http.get("http://vue.studyit.io/api/getnew/"+this.$route.params.id).then(function(data){
						
						if(data.body.status != 0 ){
						Toast({
							  message: '成功读取数据',
							  position: 'middle',
							  duration: 1000
							});
						return
						}
					this.list = data.body.message
				})
			}
		},
		components:{
			comment
		}
	}
</script>

<style>
	h3{
		padding-top: 10px;
		color: blue
	}
	.title{
		margin-bottom: 10px;
		color: #26a2ff;
		font-size:12px;
	}
</style>